#ifndef MESH_H
#define MESH_H

class Face;
class Shader;
#include "Troll3D_global.h"
#include "GeoTool/vec4.h"
#include "Vertex.h"
#include "Face.h"
#include "Image.h"

#include <vector>
#include <string>


class TROLL3DSHARED_EXPORT Mesh
{
    public :

        /************************************************/
        /*				Members 						*/
        /************************************************/

            /************************************************/
            /*				Properties 						*/
            /************************************************/

                Image*  m_Image;
				GLuint	m_ProgramGLID;					/*!< GLSL program linked to the current mesh		*/
				
                std::vector<Vertex * >	m_Vertices;     /*!<    Mesh's vertices         					*/
                std::vector<Face * >	m_Faces;       	/*!<    Mesh's face             					*/

            /************************************************/
            /*				Methods 						*/
            /************************************************/

                void AddVertex(Vertex * vertex);
                void AddFace(int a, int b, int c);

                /*! @brief This function will compute the normals of each face inside the Mesh    */
                void ComputeFaceNormals();

                /*! @brief This function will compute the normals of each vertex. Standard workflow is to first compute
                 *          the faces normals, and then, for each vertex, we compute the "means" normal of each vertex link
                 *          to the current one
                 */
                void ComputeVertexNormals();
                void Display();

        /************************************************/
        /*				Statics 						*/
        /************************************************/

            /************************************************/
            /*				Properties 						*/
            /************************************************/

            /************************************************/
            /*				Methods 						*/
            /************************************************/
			
            static  Mesh * NewTriangle(Vertex * vertex1, Vertex * vertex2, Vertex * vertex3);

            /*! @brief : Create a new rectangle. centered on zeo  */
            static  Mesh * NewRect(float width, float height);
			
            static  bool LoadMesh(std::string filePath);

        /************************************************/
        /*				Constructors					*/
        /************************************************/

        Mesh();
};

#endif
